home *** CD-ROM | disk | FTP | other *** search
/ C# & Game Programming - A…er's Guide (2nd Edition) / Buono 2nd Ed.iso / Chapter2 / 2.4 / 2.4.cs next >
Text File  |  2004-08-31  |  559b  |  22 lines

  1. /* The if-else statement. */
  2. using System;
  3.  
  4. namespace Chapter2 {
  5.     class Class1 {
  6.         static void Main() {
  7.             string input;
  8.             double Answer;  
  9.  
  10.             Console.Write("1 + 1.5 =  ");   
  11.             input = Console.ReadLine();   
  12.             Answer = double.Parse(input);
  13.            
  14.             if (Answer == 2.5)  
  15.                 Console.WriteLine("\n That is correct!\n");   
  16.             else     
  17.                 Console.WriteLine("\n Wrong!!!\n");
  18.         }
  19.     }
  20. }                                     
  21.  
  22.